﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Newtonsoft.Json.Linq;
using Sparklings.JsonUtils;

namespace Sparklings.LevelElements
{
    public class KillingTile : Tile
    {
        public KillingTile(Level l, int x, int y)
            : base(l, x, y, false)
        {
        }
        public override void LoadGraphicsRelatedElements()
        {
            base.LoadGraphicsRelatedElements();
            BaseTexture = Level.ContentManager.Load<Texture2D>("killingtile");
        }
        public override void Update(GameTime gameTime)
        {
            foreach (var s in GetCurrentlyContainedSparklings())
            {
                s.MakeDisappear();
            }
        }
        public static object ConstructFromData(JsonOverrider converter, JToken toConvert, Level level, int x, int y)
        {
            return new KillingTile(level, x, y);
        }
        public override bool IsPassableBySparkling(Sparkling c) { return true; }
    }
}
